﻿var fFrame = getParent(window);
var CLS_HDP_F = "FavTeamClass";
var CLS_HDP_N = "UdrDogTeamClass";
var TR_0 = "bgcpe";
var TR_1 = "bgcpelight";
var SEPERATE_TIME = "1059";
var g_OddsKeeper_L = null;
var g_OddsKeeper_D = null;
var arrTicks;
var TrFlag = false;
var CounterHandle_L;
var CounterHandle_D;
var InITIAL = false;

function getParent(b) {
    var a = b;
    for (var c = 0; c < 4; c++) {
        if (a.SiteMode != null) {
            return a
        } else {
            a = a.parent
        }
    }
    return null
}
if (fFrame.DisplayMode == "1H") {
    fFrame.DisplayMode = "1F"
}

function SwapOdds(b) {
    if (b == "") {
        return b
    }
    var a = parseFloat(b);
    if (a > 0) {
        return "-" + b
    } else {
        return b.replace("-", "")
    }
}

function ConvertData(a, b) {
    if (InITIAL) {
        switch (b) {
            case "W":
                if (a.length <= 20) {
                    for (var c = 0; c < a.length; c++) {
                        a[c][27] = SwapOdds(a[c][27]);
                        a[c][28] = SwapOdds(a[c][28]);
                        a[c][32] = SwapOdds(a[c][32]);
                        a[c][33] = SwapOdds(a[c][33]);
                        a[c][40] = SwapOdds(a[c][40]);
                        a[c][41] = SwapOdds(a[c][41]);
                        a[c][45] = SwapOdds(a[c][45]);
                        a[c][46] = SwapOdds(a[c][46])
                    }
                } else {
                    var c = 20;
                    if (a.length <= 50) {
                        c = 0
                    }
                    for (c; c < a.length; c++) {
                        a[c][27] = SwapOdds(a[c][27]);
                        a[c][28] = SwapOdds(a[c][28]);
                        a[c][32] = SwapOdds(a[c][32]);
                        a[c][33] = SwapOdds(a[c][33]);
                        a[c][40] = SwapOdds(a[c][40]);
                        a[c][41] = SwapOdds(a[c][41]);
                        a[c][45] = SwapOdds(a[c][45]);
                        a[c][46] = SwapOdds(a[c][46])
                    }
                }
                break;
            case "UI":
                for (var c = 0; c < a.length; c++) {
                    a[c][27] = SwapOdds(a[c][27]);
                    a[c][28] = SwapOdds(a[c][28]);
                    a[c][32] = SwapOdds(a[c][32]);
                    a[c][33] = SwapOdds(a[c][33]);
                    a[c][40] = SwapOdds(a[c][40]);
                    a[c][41] = SwapOdds(a[c][41]);
                    a[c][45] = SwapOdds(a[c][45]);
                    a[c][46] = SwapOdds(a[c][46])
                }
                break;
            case "UO":
                for (var c = 0; c < a.length; c++) {
                    switch (a[c][1]) {
                        case 1:
                        case 3:
                        case 7:
                        case 8:
                            a[c][4] = SwapOdds(a[c][4]);
                            a[c][5] = SwapOdds(a[c][5]);
                            break;
                        default:
                            break
                    }
                }
                break;
            default:
                break
        }
    }
    return a
}
var aTimespan;

//'U','04/29/2014 10:47:23','l',Dell,Srtl,Insl,uLl,uMl,uOl,uAl
//k- U/W
//l - updatetime
//j- l/t/e
//f - dell
//m - srtl
//h - insl
//p - uLl
//q- uMl
//r - uOl
//o - uAl
function ShowBetList(k, l, j, f, m, h, p, q, r, o) {
    aTimespan = new Date().getTime();
    var a;
    var b;
    var c;
    if (j == "l") {
        a = document.DataForm_L;
        b = DataFrame_L;
        c = g_OddsKeeper_L
    } else {
        a = document.DataForm_D;
        b = DataFrame_D;
        c = g_OddsKeeper_D
    }
    a.CT.value = l;
    if (k == "U") {
        if (c == null) {
            if (j == "l") {
                refreshData_L()
            } else {
                refreshData_D()
            }
            return
        }
        c.DataTags = ARR_FIELDS_DEF1["1"];
        h = ConvertData(h, "UI");
        r = ConvertData(r, "UO");
        c.refreshOddsTable(f, m, h, p, q, r, o);
        if (sKeeper != null) {
            var d = false;
            var e = false;
            for (var g = 0; g < f.length; g++) {
                if (sKeeper.MUID == f[g]) {
                    PopLauncher.close();
                    d = true
                }
            }
            for (var g = 0; g < h.length; g++) {
                if (sKeeper.MUID == h[g][0]) {
                    PopLauncher.open(100, 120);
                    e = true
                }
            }
            if (d && !e) {
                ThreadId = null
            }
        }
    } else {
        var n;
        if (j == "l") {
            n = "L";
            g_OddsKeeper_L = new OddsKeeper();
            c = g_OddsKeeper_L;
            c.tag = "L";
            c.TableContainer = document.getElementById("oTableContainer_L")
        } else {
            n = "D";
            g_OddsKeeper_D = new OddsKeeper();
            c = g_OddsKeeper_D;
            c.tag = "D";
            c.TableContainer = document.getElementById("oTableContainer_D")
        }
        switch (fFrame.DisplayMode) {
            case "1":
                if (!initialTmpl("UnderOver_tmpl_1", "UnderOver_tmpl.aspx?form=1", "ShowBetList('" + k + "','" + l + "','" + j + "', DataFrame_" + n + ".N" + j + ");")) {
                    return
                }
                c.afterNewEvent = afterNewEvent_1;
                c.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1").contentWindow);
                c.RegenEverytime = false;
                break;
            case "1F":
                if (!initialTmpl("UnderOver_tmpl_1F", "UnderOver_tmpl.aspx?form=1F", "ShowBetList('" + k + "','" + l + "','" + j + "', DataFrame_" + n + ".N" + j + ");")) {
                    return
                }
                c.afterNewEvent = afterNewEvent_1F;
                c.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1F").contentWindow);
                c.RegenEverytime = true;
                break;
            case "1H":
                if (!initialTmpl("UnderOver_tmpl_1H", "UnderOver_tmpl.aspx?form=1H", "ShowBetList('" + k + "','" + l + "','" + j + "', DataFrame_" + n + ".N" + j + ");")) {
                    return
                }
                c.afterNewEvent = afterNewEvent_1H;
                c.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1H").contentWindow);
                c.RegenEverytime = true;
                break;
            default:
                if (!initialTmpl("UnderOver_tmpl_3", "UnderOver_tmpl.aspx?form=3", "ShowBetList('" + k + "','" + l + "','" + j + "', DataFrame_" + n + ".N" + j + ");")) {
                    return
                }
                c.afterNewEvent = afterNewEvent_3;
                c.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_3").contentWindow);
                c.RegenEverytime = false;
                break
        }
        f = ConvertData(f, "W");
        c.SortType = (document.DataForm_L.OrderBy.value == "1") ? 1 : 0;
        c.afterNewLeague = afterNewLeague;
        c.afterRepaintTable = afterRepaintTable;
        c.updateAppendFields = updateAppendFields;
        c.BetTypes = ARR_BETYPE_DEF["1"];
        c.setDatas(f, ARR_FIELDS_DEF1["1"]);
        c.paintOddsTable()
    }
}

function afterNewLeague(a, c, b) {
    b = b.replace("{@Market}", document.DataForm_D.Market.value);
    return b.replace("{@Refresh}", RES_REFRESH)
}

function updateAppendFields(a, c, f, b) {
    for (var d = 0; d < a.length; d++) {
        var g = a[d][0];
        var e = f[g];
        while ((e < c.length) && (c[e]["MUID"] == g)) {
            c[e]["RedCardH"] = a[d][1];
            c[e]["RedCardA"] = a[d][2];
            if (c[e]["MatchCount"] == "1") {
                c[e]["MoreCount"] = a[d][a[d].length - 1]
            }
            e++
        }
        b[g] = "updateAppend"
    }
}

function afterNewEvent_1(a, c, b, d) {
    var f = a[c];
    if (!d && !isInPeriod(f)) {
        return ""
    }
    var e = new Array();
    if (d) {
        if (f.LivePeriod == 0) {
            e.LiveTimeCls = (f.CsStatus == "1") ? "HalfTime" : "IsLive"
        } else {
            e.LiveTimeCls = "LiveTime";
            if ((f.LivePeriod == 2) && (f.InjuryTime > 0)) {
                e.InjuryTime = "+" + f.InjuryTime
            } else {
                e.InjuryTime = ""
            }
        }
        e.RedCardH = getRedCardHtml(parseInt(f.RedCardH, 10));
        e.RedCardA = getRedCardHtml(parseInt(f.RedCardA, 10));
        if (f.Div == 0) {
            e.Tr_Cls = "live";
            e.BgColor = GetLiveBGColor(f.Div)
        } else {
            e.Tr_Cls = "liveligh";
            e.BgColor = GetLiveBGColor(f.Div)
        }
    } else {
        if (f.Div == 0) {
            e.Tr_Cls = TR_0;
            e.BgColor = GetEventBGColor(f.Div)
        } else {
            e.Tr_Cls = TR_1;
            e.BgColor = GetEventBGColor(f.Div)
        }
    }
    var g = f.FavorF;
    e.Home_Cls = (g == "h") ? CLS_HDP_F : CLS_HDP_N;
    e.Away_Cls = (g == "a") ? CLS_HDP_F : CLS_HDP_N;
    e.Odds_1_H_Cls = (f.Odds_1_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_1_A_Cls = (f.Odds_1_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_O_Cls = (f.Odds_3_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_U_Cls = (f.Odds_3_U < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_7_H_Cls = (f.Odds_7_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_7_A_Cls = (f.Odds_7_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_O_Cls = (f.Odds_8_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_U_Cls = (f.Odds_8_U < 0) ? CLS_EVEN : CLS_ODD;
    e.isParlay = 0;
    if (f.TimerSuspend == "1") {
        e.TimeSuspendCls1 = CLS_LS_OFF;
        e.TimeSuspendCls = CLS_LS_ON
    } else {
        e.TimeSuspendCls1 = CLS_LS_ON;
        e.TimeSuspendCls = CLS_LS_OFF
    } if ((c == 0) || (a[c - 1]["MatchId"] != f.MatchId)) {
        e.StatsInfo = f.StatsId == "0" || f.StatsId == "2" ? "" : getStatsHtml(f.MatchId);
        e.LiveChart = f.StatsId == "0" || f.StatsId == "1" ? "" : getLiveChartHtml(f.MatchId);
        e.SportRadarInfo = f.SportRadar == 0 ? "" : getSportRadarHtml(f.MatchId, d ? "IsLive" : "");
        e.Streaming = getStreamingHtml(f.MatchId, f.StreamingId, d);
        e.Favorites = getFavoritesHtml(f.MUID, f.MatchCode, (f.Favorite == "1"), d);
        e.More = getMoreLabel_1(f.MoreCount, f.OddsId_5, f.OddsId_15);
        e.ScoreMap = getScoreMapHtml(f.MatchId)
    }
    e.TimerSuspend = f.TimerSuspend;
    b = _formatTemplate(b, "{@", "}");
    b = _replaceTags(e, b);
    return b
}

function afterNewEvent_3(a, c, b, d) {
    var f = a[c];
    if (!d && !isInPeriod(f)) {
        return ""
    }
    var e = new Array();
    e.Market = document.DataForm_D.Market.value;
    e.Odds_1_H_Cls = (f.Odds_1_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_1_A_Cls = (f.Odds_1_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_O_Cls = (f.Odds_3_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_U_Cls = (f.Odds_3_U < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_7_H_Cls = (f.Odds_7_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_7_A_Cls = (f.Odds_7_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_O_Cls = (f.Odds_8_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_U_Cls = (f.Odds_8_U < 0) ? CLS_EVEN : CLS_ODD;
    e.Draw = getDrawHtml(f.OddsId_5 != "" || f.OddsId_15 != "");
    if (d) {
        if (f.LivePeriod == 0) {
            e.LiveTimeCls = (f.CsStatus == "1") ? "HalfTime" : "IsLive"
        } else {
            e.LiveTimeCls = "LiveTime";
            if ((f.LivePeriod == 2) && (f.InjuryTime > 0)) {
                e.InjuryTime = "+" + f.InjuryTime
            } else {
                e.InjuryTime = ""
            }
        }
        e.RedCardH = getRedCardHtml(parseInt(f.RedCardH, 10));
        e.RedCardA = getRedCardHtml(parseInt(f.RedCardA, 10));
        if (f.Div == 0) {
            e.Tr_Cls = "live";
            e.BgColor = GetLiveBGColor(f.Div)
        } else {
            e.Tr_Cls = "liveligh";
            e.BgColor = GetLiveBGColor(f.Div)
        }
    } else {
        if (f.Div == 0) {
            e.Tr_Cls = TR_0;
            e.BgColor = GetEventBGColor(f.Div)
        } else {
            e.Tr_Cls = TR_1;
            e.BgColor = GetEventBGColor(f.Div)
        }
    }
    switch (f.FavorF) {
        case "h":
            e.Home_Cls = CLS_HDP_F;
            e.Away_Cls = CLS_HDP_N;
            e.Value_1_H = f.Value_1;
            e.Value_1_A = "";
            break;
        case "a":
            e.Home_Cls = CLS_HDP_N;
            e.Away_Cls = CLS_HDP_F;
            e.Value_1_H = "";
            e.Value_1_A = f.Value_1;
            break;
        default:
            e.Home_Cls = CLS_HDP_N;
            e.Away_Cls = CLS_HDP_N;
            if (f.Odds_1_H != "") {
                e.Value_1_H = "0"
            } else {
                e.Value_1_H = ""
            }
            e.Value_1_A = ""
    }
    switch (f.FavorH1) {
        case "h":
            e.Value_7_H = f.Value_7;
            e.Value_7_A = "";
            break;
        case "a":
            e.Value_7_H = "";
            e.Value_7_A = f.Value_7;
            break;
        default:
            if (f.Odds_7_H != "") {
                e.Value_7_H = "0"
            } else {
                e.Value_7_H = ""
            }
            e.Value_7_A = ""
    }
    e.UNDER_3 = (f.Goal_3 == "") ? "" : RES_UNDER;
    e.UNDER_8 = (f.Goal_8 == "") ? "" : RES_UNDER;
    e.isParlay = 0;
    if (f.TimerSuspend == "1") {
        e.TimeSuspendCls1 = CLS_LS_OFF;
        e.TimeSuspendCls = CLS_LS_ON
    } else {
        e.TimeSuspendCls1 = CLS_LS_ON;
        e.TimeSuspendCls = CLS_LS_OFF
    } if ((c == 0) || (a[c - 1]["MatchId"] != f.MatchId)) {
        e.ShowMatch = getShowMatchHtml(f.MatchId, 1, document.DataForm_D.Market.value);
        e.StatsInfo = f.StatsId == "0" || f.StatsId == "2" ? "" : getStatsHtml(f.MatchId);
        e.LiveChart = f.StatsId == "0" || f.StatsId == "1" ? "" : getLiveChartHtml(f.MatchId);
        e.SportRadarInfo = f.SportRadar == 0 ? "" : getSportRadarHtml(f.MatchId, d ? "IsLive" : "");
        e.Streaming = getStreamingHtml(f.MatchId, f.StreamingId, d);
        var g = (document.DataForm_L.OrderBy.value == "1") ? f.KickoffTime : f.MatchCode;
        e.Favorites = getFavoritesHtml(f.MUID, g, (f.Favorite == "1"), d);
        e.More = getMoreLabel_3(f.MoreCount, d);
        e.ScoreMap = getScoreMapHtml(f.MatchId)
    }
    return _replaceTags(e, _formatTemplate(b, "{@", "}"))
}
var PreMatchId;

function afterNewEvent_1F(a, c, b, d) {
    var f = a[c];
    if (!d && !isInPeriod(f)) {
        return ""
    }
    if ((f.Value_1 == "") && (f.OddsId_1 == "") && (f.Goal_3 == "") && (f.OddsId_3 == "")) {
        return ""
    }
    var e = new Array();
    if (c == 0) {
        TrFlag = false
    }
    if (PreMatchId != f.MatchId) {
        TrFlag = !TrFlag
    }
    f.Div = (TrFlag) ? 0 : 1;
    if (d) {
        if (f.LivePeriod == 0) {
            e.LiveTimeCls = (f.CsStatus == "1") ? "HalfTime" : "IsLive"
        } else {
            e.LiveTimeCls = "LiveTime";
            if ((f.LivePeriod == 2) && (f.InjuryTime > 0)) {
                e.InjuryTime = "+" + f.InjuryTime
            } else {
                e.InjuryTime = ""
            }
        }
        e.RedCardH = getRedCardHtml(parseInt(f.RedCardH, 10));
        e.RedCardA = getRedCardHtml(parseInt(f.RedCardA, 10));
        if (f.Div == 0) {
            e.Tr_Cls = "live";
            e.BgColor = GetLiveBGColor(f.Div)
        } else {
            e.Tr_Cls = "liveligh";
            e.BgColor = GetLiveBGColor(f.Div)
        }
    } else {
        if (f.Div == 0) {
            e.Tr_Cls = TR_0;
            e.BgColor = GetEventBGColor(f.Div)
        } else {
            e.Tr_Cls = TR_1;
            e.BgColor = GetEventBGColor(f.Div)
        }
    }
    var g = f.FavorF;
    e.Home_Cls = (g == "h") ? CLS_HDP_F : CLS_HDP_N;
    e.Away_Cls = (g == "a") ? CLS_HDP_F : CLS_HDP_N;
    e.Odds_1_H_Cls = (f.Odds_1_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_1_A_Cls = (f.Odds_1_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_O_Cls = (f.Odds_3_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_3_U_Cls = (f.Odds_3_U < 0) ? CLS_EVEN : CLS_ODD;
    e.isParlay = 0;
    if (f.TimerSuspend == "1") {
        e.TimeSuspendCls1 = CLS_LS_OFF;
        e.TimeSuspendCls = CLS_LS_ON
    } else {
        e.TimeSuspendCls1 = CLS_LS_ON;
        e.TimeSuspendCls = CLS_LS_OFF
    } if ((c == 0) || (a[c - 1]["MatchId"] != f.MatchId)) {
        e.StatsInfo = f.StatsId == "0" || f.StatsId == "2" ? "" : getStatsHtml(f.MatchId);
        e.LiveChart = f.StatsId == "0" || f.StatsId == "1" ? "" : getLiveChartHtml(f.MatchId);
        e.SportRadarInfo = f.SportRadar == 0 ? "" : getSportRadarHtml(f.MatchId, d ? "IsLive" : "");
        e.Streaming = getStreamingHtml(f.MatchId, f.StreamingId, d);
        e.Favorites = getFavoritesHtml(f.MUID, f.MatchCode, (f.Favorite == "1"), d);
        e.More = getMoreLabel_1(f.MoreCount, f.OddsId_5, f.OddsId_15);
        e.ScoreMap = getScoreMapHtml(f.MatchId)
    }
    b = _formatTemplate(b, "{@", "}");
    b = _replaceTags(e, b);
    return b
}

function afterNewEvent_1H(a, c, b, d) {
    var f = a[c];
    if (!d && !isInPeriod(f)) {
        return ""
    }
    if ((f.Value_7 == "") && (f.OddsId_7 == "") && (f.Goal_8 == "") && (f.OddsId_8 == "")) {
        return ""
    }
    var e = new Array();
    if (c == 0) {
        TrFlag = false
    }
    if (PreMatchId != f.MatchId) {
        TrFlag = !TrFlag
    }
    f.Div = (TrFlag) ? 0 : 1;
    if (d) {
        if (f.LivePeriod == 0) {
            e.LiveTimeCls = (f.CsStatus == "1") ? "HalfTime" : "IsLive"
        } else {
            e.LiveTimeCls = "LiveTime";
            if ((f.LivePeriod == 2) && (f.InjuryTime > 0)) {
                e.InjuryTime = "+" + f.InjuryTime
            } else {
                e.InjuryTime = ""
            }
        }
        e.RedCardH = getRedCardHtml(parseInt(f.RedCardH, 10));
        e.RedCardA = getRedCardHtml(parseInt(f.RedCardA, 10));
        if (f.Div == 0) {
            e.Tr_Cls = "live";
            e.BgColor = GetLiveBGColor(f.Div)
        } else {
            e.Tr_Cls = "liveligh";
            e.BgColor = GetLiveBGColor(f.Div)
        }
    } else {
        if (f.Div == 0) {
            e.Tr_Cls = TR_0;
            e.BgColor = GetEventBGColor(f.Div)
        } else {
            e.Tr_Cls = TR_1;
            e.BgColor = GetEventBGColor(f.Div)
        }
    }
    var g = f.FavorH1;
    e.Home_Cls = (g == "h") ? CLS_HDP_F : CLS_HDP_N;
    e.Away_Cls = (g == "a") ? CLS_HDP_F : CLS_HDP_N;
    e.Odds_7_H_Cls = (f.Odds_7_H < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_7_A_Cls = (f.Odds_7_A < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_O_Cls = (f.Odds_8_O < 0) ? CLS_EVEN : CLS_ODD;
    e.Odds_8_U_Cls = (f.Odds_8_U < 0) ? CLS_EVEN : CLS_ODD;
    e.isParlay = 0;
    if (f.TimerSuspend == "1") {
        e.TimeSuspendCls1 = CLS_LS_OFF;
        e.TimeSuspendCls = CLS_LS_ON
    } else {
        e.TimeSuspendCls1 = CLS_LS_ON;
        e.TimeSuspendCls = CLS_LS_OFF
    } if ((c == 0) || (a[c - 1]["MatchId"] != f.MatchId)) {
        e.StatsInfo = f.StatsId == "0" || f.StatsId == "2" ? "" : getStatsHtml(f.MatchId);
        e.LiveChart = f.StatsId == "0" || f.StatsId == "1" ? "" : getLiveChartHtml(f.MatchId);
        e.SportRadarInfo = f.SportRadar == 0 ? "" : getSportRadarHtml(f.MatchId, d ? "IsLive" : "");
        e.Streaming = getStreamingHtml(f.MatchId, f.StreamingId, d);
        e.Favorites = getFavoritesHtml(f.MUID, f.MatchCode, (f.Favorite == "1"), d);
        e.More = getMoreLabel_1(f.MoreCount, f.OddsId_5, f.OddsId_15);
        e.ScoreMap = getScoreMapHtml(f.MatchId)
    }
    b = _formatTemplate(b, "{@", "}");
    b = _replaceTags(e, b);
    return b
}
var btnStartHandle_L;
var btnStartHandle_D;

function afterScoreChanged(a, c) {
    if (c < a.length && c >= 0 && a.length > 0) {
        var f = a[c];
        var e = new Array();
        e.HomeName = f.HomeName;
        e.AwayName = f.AwayName;
        e.ScoreH = f.ScoreH;
        e.ScoreA = f.ScoreA;
        e.ShowTime = f.ShowTime;
        if (f.InjuryTime != "" && f.InjuryTime != "0") {
            e.InjuryTime = "+" + f.InjuryTime
        } else {
            e.InjuryTime = ""
        }
        var b = fFrame.ScoreMsg;
        b = _formatTemplate(b, "{@", "}");
        b = _replaceTags(e, b);
        var d = new MsgBox(b, 10000, 5, "MainMsg");
        d.openMsg()
    }
}

function afterRepaintTable(d) {
    var a;
    if (d.parentNode.id == "oTableContainer_L") {
        document.DataForm_L.RT.value = "U";
        a = document.getElementById("oTableContainer_D");
        window.clearTimeout(btnStartHandle_L);
        btnStartHandle_L = setTimeout("startButton('l');", 3000)
    } else {
        document.DataForm_D.RT.value = "U";
        a = document.getElementById("oTableContainer_L");
        window.clearTimeout(btnStartHandle_D);
        btnStartHandle_D = setTimeout("startButton('d');", 3000)
    }
    var b = document.getElementById("disstyle").value;
    var e = document.getElementById("selPeriod").value;
    if ((b == "1H") || (b == "1F") || (e != "0")) {
        purgeLeagueRow_1H(d)
    }
    document.getElementById("BetList").style.display = "none";
    document.getElementById("OddsTr").style.display = "block";
    var c = 0;
    if (d.tBodies.length > 0) {
        c = d.tBodies.length - 1
    }
    if (d.tBodies[c].rows.length <= 1) {
        d.parentNode.style.display = "none";
        if (a.style.display == "none") {
            if (document.body.id == "Favorite") {
                alert(RES_NonFavoriteMsg);
                fFrame.leftFrame.SwitchMenuType(0, "")
            }
            document.getElementById("TrNoInfo").style.display = "block"
        } else {
            document.getElementById("TrNoInfo").style.display = "none"
        } if (d.parentNode.id == "oTableContainer_L") {
            document.getElementById("btnRefresh_L").style.display = "none";
            if (fFrame.SiteMode == 2) {
                if (fFrame.Deposit_SiteMode == 2) {
                    document.getElementById("RunningGames").style.display = "none"
                }
            }
        } else {
            document.getElementById("btnRefresh_D").style.display = "none";
            if (fFrame.SiteMode == 2) {
                if (fFrame.Deposit_SiteMode == 2) {
                    document.getElementById("sub_title").style.display = "none"
                }
            }
        }
    } else {
        d.parentNode.style.display = "";
        document.getElementById("TrNoInfo").style.display = "none";
        if (d.parentNode.id == "oTableContainer_L") {
            document.getElementById("btnRefresh_L").style.display = "";
            if (fFrame.SiteMode == 2) {
                if (fFrame.Deposit_SiteMode == 2) {
                    document.getElementById("RunningGames").style.display = ""
                }
            }
        } else {
            document.getElementById("btnRefresh_D").style.display = ""
        }
    }
    window.setTimeout(popHorseAD, 2000);
    if (typeof (myScroll) != "undefined") {
        myScroll.refresh()
    }
}

function getMoreLabel_1(a, c, b) {
    if (a == 0) {
        if (fFrame.DisplayMode == "1") {
            if ((c == "") && (b == "")) {
                return ""
            }
        } else {
            if (fFrame.DisplayMode == "1F") {
                if (c == "") {
                    return ""
                }
            } else {
                if (fFrame.DisplayMode == "1H") {
                    if (b == "") {
                        return ""
                    }
                } else {
                    if (fFrame.DisplayMode == "3") {
                        return ""
                    }
                }
            }
        }
    }
    return '<span class="iconOdds more" title="' + RES_MORE + '"></span>'
}

function getMoreLabel_3(a) {
    if (a == 0) {
        return ""
    } else {
        return RES_MORE + "+" + a
    }
}

function purgeLeagueRow_1H(d) {
    var b;
    var c = 0;
    if (d.tBodies.length > 0) {
        c = d.tBodies.length - 1
    }
    var e = d.tBodies[c];
    for (var a = e.rows.length - 1; a >= 0; a--) {
        if (e.rows[a].id.charAt(0) == "l") {
            b++
        } else {
            b = 0
        } if (b > 1) {
            e.deleteRow(a)
        }
    }
    while ((e.rows.length > 0) && (e.rows[e.rows.length - 1].id.charAt(0) == "l")) {
        e.deleteRow(e.rows.length - 1)
    }
}

function changeDisplayMode(b, a) {
    if (g_OddsKeeper_D == null) {
        return
    }
    fFrame.DisplayMode = b;
    setCookie("DispVer", b, 7, "", a);
    switch (b) {
        case "1":
            if (!initialTmpl("UnderOver_tmpl_1", "UnderOver_tmpl.aspx?form=1", "changeDisplayMode('" + b + "','" + a + "');")) {
                return
            }
            break;
        case "3":
            if (!initialTmpl("UnderOver_tmpl_3", "UnderOver_tmpl.aspx?form=3", "changeDisplayMode('" + b + "','" + a + "');")) {
                return
            }
            break;
        case "1F":
            if (!initialTmpl("UnderOver_tmpl_1F", "UnderOver_tmpl.aspx?form=1F", "changeDisplayMode('" + b + "','" + a + "');")) {
                return
            }
            break;
        case "1H":
            if (!initialTmpl("UnderOver_tmpl_1H", "UnderOver_tmpl.aspx?form=1H", "changeDisplayMode('" + b + "','" + a + "');")) {
                return
            }
            break
    }
    if ((PAGE_MARKET == "t") && (g_OddsKeeper_L != null)) {
        window.clearTimeout(CounterHandle_L);
        stopButton("l");
        setDisplayMode(b, g_OddsKeeper_L)
    }
    window.clearTimeout(CounterHandle_D);
    stopButton("d");
    setDisplayMode(b, g_OddsKeeper_D);
    Rechkskeeper_5_15()
}

function setDisplayMode(b, a) {
    switch (b) {
        case "1":
            a.afterNewEvent = afterNewEvent_1;
            a.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1").contentWindow);
            a.RegenEverytime = false;
            break;
        case "3":
            a.afterNewEvent = afterNewEvent_3;
            a.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_3").contentWindow);
            a.RegenEverytime = false;
            break;
        case "1F":
            a.afterNewEvent = afterNewEvent_1F;
            a.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1F").contentWindow);
            a.RegenEverytime = true;
            break;
        case "1H":
            a.afterNewEvent = afterNewEvent_1H;
            a.setTemplate(fFrame.document.getElementById("UnderOver_tmpl_1H").contentWindow);
            a.RegenEverytime = true;
            break
    }
    a.paintOddsTable()
}
var g_SelDisstyle_InnerHTML;

function initialDisstyle(b) {
    var a = $("#disstyle_menu");
    if (a.children().length > 0) {
        if (b == "old") {
            fFrame.DisplayMode = "1F"
        } else {
            if (b == "new") {
                fFrame.DisplayMode = "3"
            } else {
                fFrame.DisplayMode = b
            }
        }
        switch (fFrame.DisplayMode) {
            case "1":
                $(a.children()[0]).click();
                break;
            case "3":
                $(a.children()[1]).click();
                break;
            case "1F":
                $(a.children()[2]).click();
                break;
            case "1H":
                $(a.children()[3]).click();
                break;
            default:
                $(a.children()[1]).click()
        }
        a[0].style.visibility = "hidden"
    }
}

function changeOddsType_ou(b) {
    if (PopLauncher != null) {
        PopLauncher.close()
    }
    var a = document.getElementById("selOddsType");
    if (a.value != b) {
        a.value = b
    }
    document.DataForm_L.OddsType.value = b;
    document.DataForm_D.OddsType.value = b;
    document.DataForm_L.RT.value = "W";
    document.DataForm_D.RT.value = "W";
    refreshAll();
    if (fFrame.topFrame.miniOddsObj != null) {
        fFrame.topFrame.miniOddsObj.Refresh(b)
    }
}

function changePeriod(a) {
    g_OddsKeeper_D.paintOddsTable()
}

function isInPeriod(a) {
    if (document.getElementById("tdSelPeriod").style.display == "none") {
        return true
    }
    var b = document.getElementById("selPeriod").value;
    switch (b) {
        case "0":
            return true;
        case "1":
            return (a.KickoffTime.substr(8, 4) <= SEPERATE_TIME);
        case "2":
            return (a.KickoffTime.substr(8, 4) > SEPERATE_TIME);
        default:
            return true
    }
}

function setSelPeriodMode(a, b) {
    var d = document.getElementById("tdSelPeriod");
    var c = document.getElementById("selPeriod");
    var e = d.style.display;
    if (b < 200) {
        d.style.display = "none"
    } else {
        if (document.DataForm_D.Market.value != "t") {
            d.style.display = "none"
        } else {
            if (a >= SEPERATE_TIME) {
                d.style.display = "none"
            } else {
                if (document.DataForm_D.RT.value == "W") {
                    c.options[0].selected = true
                }
                d.style.display = ""
            }
        }
    } if ((d.style.display != e) && (d.style.display == "none")) {
        window.clearTimeout(CounterHandle_D);
        g_OddsKeeper_D.paintOddsTable()
    }
}
var PopLauncher;
var ADLauncher;
var NewsLauncher;

function popMore(m, f, e, b, a, d, c) {
    document.getElementById("oPopContainer").innerHTML = "";
    var k = document.MoreForm.Market.value;
    document.MoreForm.MatchId.value = f;
    document.MoreForm.LeagueName.value = e;
    document.MoreForm.HomeName.value = b;
    document.MoreForm.AwayName.value = a;
    document.MoreForm.isParlay.value = d;
    if (c == "l") {
        document.MoreForm.Market.value = c
    }
    document.MoreForm.action = "UnderOverPop.aspx";
    document.MoreForm.submit();
    document.MoreForm.Market.value = k;
    var h = document.getElementById("PopDiv");
    h.style.width = (m + 100) + "px";
    var l = document.getElementById("PopTitleText");
    l.innerHTML = b + " -vs- " + a;
    if (PopLauncher == null) {
        var j = document.getElementById("PopTitle");
        var g = document.getElementById("PopCloser");
        PopLauncher = new DivLauncher(h, j, g)
    }
    PopLauncher.open(100, 120)
}

function popAD() {
    if (fFrame.PopupAD) {
        fFrame.PopupAD = false;
        var b = document.getElementById("AcgDiv");
        var c = document.getElementById("AcgTitleBar");
        var a = document.getElementById("AcgCloser");
        if (b != null) {
            ADLauncher = new DivLauncher(b, c, a);
            ADLauncher.afterClose = ADafterClose;
            ADLauncher.open()
        }
    }
}

function ADafterClose(a) {
    a.innerHTML = "";
    a = null
}

function popNews() {
    if (fFrame.PopupNews) {
        fFrame.PopupNews = false;
        if (checkFlashSupport(fFrame.FlashSupport)) {
            var b = document.getElementById("NewsDiv");
            var c = document.getElementById("NewsTitleBar");
            var a = document.getElementById("NewsCloser");
            if (b != null) {
                NewsLauncher = new DivLauncher(b, c, a);
                NewsLauncher.open()
            }
        }
    }
}
var HADLauncher;

function popHorseAD() {
    if (fFrame.PopupFAD) {
        fFrame.PopupFAD = false;
        var a = document.getElementById("divFAD");
        if (a != null) {
            HADLauncher = new DivLauncher(a);
            HADLauncher.open(90, 150)
        }
    }
}

function closePopup() {
    if (NewsLauncher != null) {
        NewsLauncher.close()
    }
}

function SelectChange() {
    if (fFrame.SiteMode != 1) {
        stopButton()
    } else {
        stopButton(document.DataForm_D.Market.value)
    } if ((PAGE_MARKET == "t") && (fFrame.SiteMode != 1)) {
        document.formLeagueList.target = "DataFrame_L";
        document.formLeagueList.Market.value = document.DataForm_L.Market.value;
        document.formLeagueList.DT.value = document.DataForm_L.DT == null ? "" : document.DataForm_L.DT.value;
        document.formLeagueList.OrderBy.value = document.DataForm_L.OrderBy.value;
        document.formLeagueList.submit()
    }
    document.formLeagueList.target = "DataFrame_D";
    document.formLeagueList.Market.value = document.DataForm_D.Market.value;
    document.formLeagueList.DT.value = document.DataForm_D.DT == null ? "" : document.DataForm_D.DT.value;
    document.formLeagueList.OrderBy.value = document.DataForm_D.OrderBy.value;
    document.formLeagueList.submit()
}

function SelectRefresh(a, b) {
    $.ajax({
        type: "post",
        url: "League.aspx",
        data: {
            GameMode: a,
            From: "p",
            Market: b,
            Sport: "1"
        },
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        cache: false,
        asyncBoolean: false,
        error: function (c) { },
        success: function (e) {
            if (e != "") {
                var d = document.getElementById("SelLeague");
                var c = $("#LF").val();
                d.innerHTML = "";
                d.innerHTML = e;
                $("#LF").val(c)
            }
            setTimeout("SelectRefresh('" + a + "','" + b + "')", 30000)
        }
    })
}

function go() {
    if (fFrame.leftFrame == null || fFrame.leftFrame.eObj == null) {
        window.setTimeout("go()", 500);
        return
    }
    var a = document.getElementById("chkLFAll");
    var b = document.getElementsByName("LF");
    if (a.checked) {
        for (i = 0; i < b.length; i++) {
            b[i].checked = false
        }
        a.checked = true
    } else {
        for (i = 0; i < b.length; i++) {
            if (b[i].value == "") {
                b[i].checked = false
            }
        }
    } if (document.DataForm_D.Market != null) {
        document.LeagueForm.OrderBy.value = document.DataForm_D.OrderBy.value
    }
    if ((PAGE_MARKET == "t") && (fFrame.SiteMode != 1)) {
        document.LeagueForm.Game.value = fFrame.LastSelectedMenu;
        document.LeagueForm.Market.value = document.DataForm_L.Market.value;
        document.LeagueForm.DT.value = document.DataForm_L.DT == null ? "" : document.DataForm_L.DT.value;
        document.LeagueForm.DispRang.value = "0";
        document.LeagueForm.target = "DataFrame_L";
        if (document.LeagueForm.key != null) {
            document.LeagueForm.key.value = fFrame.leftFrame.eObj.GetKey("selodds")
        }
        stopButton("l");
        document.LeagueForm.submit()
    }
    document.LeagueForm.Game.value = fFrame.LastSelectedMenu;
    document.LeagueForm.Market.value = document.DataForm_D.Market.value;
    document.LeagueForm.DT.value = document.DataForm_D.DT == null ? "" : document.DataForm_D.DT.value;
    document.LeagueForm.DispRang.value = document.DataForm_D.DispRang.value;
    document.LeagueForm.target = "DataFrame_D";
    if (document.LeagueForm.key != null) {
        document.LeagueForm.key.value = fFrame.leftFrame.eObj.GetKey("selodds")
    }
    stopButton("d");
    document.LeagueForm.submit();
    PopLauncher.close()
}

function selectDate(b, a) {
    if (!REFRESH_GAP_D) {
        return
    }
    if (document.DataForm_D.DT.value != a) {
        $("#divSelectDate").find("span").css("color", siteObj._SelectDateColor_Def);
        b.style.color = siteObj._SelectDateColor_Sel;
        document.DataForm_D.DT.value = a;
        document.DataForm_D.RT.value = "W"
    }
    window.clearTimeout(CounterHandle_D);
    refreshData_D()
}

function addFavorites(f, e, c, d) {
    var h = f.substr(2, f.length - 2);
    var g = document.getElementById("fav_" + f);
    var a = (d) && (!siteObj._IsPhonebet) ? g_OddsKeeper_L : g_OddsKeeper_D;
    var b;
    if (a.SortType == 1) {
        b = a.findIndex("KickoffTime", e);
        b = a.adjustIndex1st(b, "KickoffTime", e, f)
    } else {
        b = a.findIndex("MatchCode", e);
        b = a.adjustIndex1st(b, "MatchCode", e, f)
    } if (c) {
        g.parentElement.href = String.format("javascript:addFavorites('{0}','{1}',0,{2});", f, e, d);
        g.parentElement.title = fFrame.RES_AddFavorite;
        g.className = "iconOdds favorite";
        fav.location.href = "addFavorites.aspx?MatchId=" + h + "&Action=Delete";
        if (a.EventList[b]["MUID"] == f) {
            a.EventList[b]["Favorite"] = ""
        }
    } else {
        g.parentElement.href = String.format("javascript:addFavorites('{0}','{1}',1,{2});", f, e, d);
        g.parentElement.title = fFrame.RES_RemoveFavorite;
        g.className = "iconOdds favoriteAdd";
        fav.location.href = "addFavorites.aspx?MatchId=" + h + "&Action=Add";
        if (a.EventList[b]["MUID"] == f) {
            a.EventList[b]["Favorite"] = "1"
        }
    }
}

function getDrawHtml(a) {
    if (!a) {
        return ""
    } else {
        return '<div class="HdpGoalClass">' + RES_DRAW + "</div>"
    }
}

function setRefreshMini(a, b) {
    var c = document.getElementById("miniver");
    var d = document.getElementById("column1");
    var e = document.getElementById("column2");
    var f = document.getElementById("tabbox");
    var g = document.getElementById("oTableContainer_L");
    var h = document.getElementById("oTableContainer_D");
    var j = document.getElementById("divSelectDate");
    var k = document.getElementById("HourContainer");
    var l = a.substring(0, 2);
    c.className = b;
    c.innerHTML = "<a href=\"javascript:setRefreshMini('" + b + "','" + a + "');\"></a>";
    if (l == "ma") {
        setCookie("MiniKey", "max", 7, "", RES_DOMAIN);
        d.className = "column3";
        e.className = "column3";
        f.className = "tabbox";
        g.className = "tabbox_F";
        h.className = "tabbox_F";
        j.className = "EarlyMarket_top_bg";
        k.className = "EarlyMarket_top_bg"
    } else {
        setCookie("MiniKey", "min", 7, "", RES_DOMAIN);
        d.className = "column3_75";
        e.className = "column3_75";
        f.className = "tabbox_75";
        g.className = "tabbox_F_75";
        h.className = "tabbox_F_75";
        j.className = "EarlyMarket_top_bg_75";
        k.className = "EarlyMarket_top_bg_75"
    }
    changeDisplayMode(fFrame.DisplayMode, RES_DOMAIN)
}
var currentHour = 0;
var changeDay = false;
var Hourlbl = new Array();
var HourClass = new Array();
Hourlbl[0] = "";
Hourlbl[1] = "";
Hourlbl[2] = "";
Hourlbl[3] = "";
Hourlbl[4] = "";
Hourlbl[5] = "";
Hourlbl[6] = "";
HourClass[0] = 0;
HourClass[1] = 3;
HourClass[2] = 7;
HourClass[3] = 11;
HourClass[4] = 15;
HourClass[5] = 19;
HourClass[6] = 23;
var isIe = (window.ActiveXObject) ? true : false;

function updateHour(a, d, b) {
    currentHour = a;
    var e = document.getElementById("Tbl_TimeRange");
    if (d) {
        if (Hourlbl[0] == "") {
            for (var c = 0; c < 7; c++) {
                Hourlbl[c] = document.getElementById("HourSpan" + HourClass[c]).innerHTML
            }
        }
        e.style.display = "";
        document.DataForm_D.DispRang.value = b;
        getHourData()
    } else {
        document.DataForm_D.DispRang.value = "0";
        e.style.display = "none"
    }
}

function getHourData() {
    Initial4Hour();
    var a = parseInt(document.DataForm_D.DispRang.value, 10);
    var b = document.getElementById("HourSpan" + a);
    setSelecter("HourContainer", b, a);
    if (a != 0) {
        if (a != 23) {
            if (document.getElementById("HourSpan" + a).style.display == "none") {
                HourLinkClick(document.getElementById("HourSpan" + (a + 4)), a + 4)
            }
        } else {
            if (changeDay) {
                changeDay = false;
                HourLinkClick(document.getElementById("HourSpan3"), 3)
            }
        }
    }
}
var g_HourOptioner;

function Initial4Hour() {
    var a = true;
    for (var b = 0; b < 7; b++) {
        if (b == 6) {
            if (currentHour == 23 && document.getElementById("HourSpan" + HourClass[b]).innerHTML == RES_NOW + Hourlbl[b].substr(5, 6)) {
                changeDay = true
            }
        }
        document.getElementById("HourSpan" + HourClass[b]).innerHTML = Hourlbl[b];
        if ((b == 0) || (currentHour < HourClass[b]) || currentHour == 23) {
            document.getElementById("HourSpan" + HourClass[b]).style.display = "";
            if (b != 0) {
                if (a) {
                    document.getElementById("HourSpan" + HourClass[b]).innerHTML = RES_NOW + Hourlbl[b].substr(5, 6);
                    a = false
                }
            }
        } else {
            document.getElementById("HourSpan" + HourClass[b]).style.display = "none"
        }
    }
}
var div_4hour_x;

function popHourContainer(b) {
    Initial4Hour();
    var a = document.getElementById("HourContainer");
    if (g_HourOptioner == null) {
        a.style.position = "absolute";
        a.style.display = "block";
        div_4hour_x = a.offsetLeft;
        g_HourOptioner = new DivOption(a, 5)
    }
    if (siteObj._IsPhonebet) {
        g_HourOptioner.Div.style.left = div_4hour_x + "px"
    } else {
        if (document.getElementById("HourSpan3").style.display == "none") {
            g_HourOptioner.Div.style.left = (div_4hour_x - 40) + "px"
        } else {
            g_HourOptioner.Div.style.left = (div_4hour_x - 120) + "px"
        }
    }
    g_HourOptioner.act(b)
}

function HourLinkClick(d, c) {
    if (fFrame.leftFrame == null || fFrame.leftFrame.eObj == null) {
        window.setTimeout("HourLinkClick('" + d + "','" + c + "')", 500);
        return
    }
    if (document.DataForm_D.DispRang.value != c) {
        var a = document.getElementById("HourContainer");
        for (var b = 0; b < a.childNodes.length; b++) {
            var e = a.childNodes[b].tagName;
            if ((e != null) && (e.toUpperCase() == "SPAN")) {
                a.childNodes[b].style.color = siteObj._4HourColor
            }
        }
        if (g_HourOptioner != null) {
            g_HourOptioner.close()
        }
        stopButton("d");
        setTimeout(function () {
            document.DataForm_D.DispRang.value = c;
            document.DataForm_D.RT.value = "W";
            if (document.DataForm_D.key != null) {
                document.DataForm_D.key.value = fFrame.leftFrame.eObj.GetKey("dodds")
            }
            document.DataForm_D.submit()
        }, 1000)
    }
}

function GotoNumberGame() {
    closePopup();
    fFrame.leftFrame.SwitchSport("", "161")
};